package com.shao.demo.rabbitmqdemo.rabbitMq;

import org.springframework.amqp.rabbit.annotation.RabbitHandler;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

/**
 *
 * 创建消息消费者Receiver。通过@Rabb辽归江ener 注解定义该类对hello 队
 * 列的监听， 并用@Rabb江Handler 注解来指定对消息的处理方法。所以， 该消费
 * 者实现了对hello 队列的消费， 消费操作为输出消息的字符串内容
 * @author zhiqi.shao
 * @Date 2018/5/31 17:13
 */
@Component
@RabbitListener(queues = "hello")
public class Receiver {

    @RabbitHandler
    public void process(String hello) {
        System.out.println("Receiver : " + hello);
    }
}
